import { connect } from 'react-redux';
import NameUiCom from './nameUiCom';
import { testAxiosFun } from '../../serve/test';

const mapStateToProps = function (state) {
    return {
        val: state.nameRenducer.name
    };
};
const mapDispachToProps = function (disPatch) {
    return {
        clickName: () => {
            testAxiosFun().then(data => {
                disPatch({
                    type: 'changeName',
                    name: data.data.newName
                });
            });
        }
    };
};

export default connect(mapStateToProps, mapDispachToProps)(NameUiCom);
